<template>
    <el-menu
      default-active="$route.path"
      class="menu"
      @open="handleOpen"
      @close="handleClose">
        <!-- 头像以及用户身份显示 -->
        <div class="userAvatar">
            <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></el-avatar>
        </div>
        <el-row class="welcomeFont">Welcome Back</el-row>
      <el-menu-item index="/unfinished">
        <i class="el-icon-menu"></i>
        <span slot="title">待办</span>
      </el-menu-item>
      <el-menu-item index="/finished">
        <i class="el-icon-document"></i>
        <span slot="title">已完成</span>
      </el-menu-item>
    </el-menu>
</template>


<script>
export default {
  name: 'pageAside',
   methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }
}
</script>

<style scoped>
.userAvatar{
    justify-content:center;
    align-items:center;
    padding: 20px;
    display: flex;
}
.welcomeFont{
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    font: 20px PingFangSC-Regular, sans-serif;
    font-weight: bolder;
}
.menu{
    display:flex;
    flex-direction: column;
    flex:1;
    position:fixed;
    box-sizing: border-box;
    overflow:hidden;
    background-color: #F4F4F4;
    width: 300px;
    height: 100%;

}
.el-menu-item {
  display:flex;
  position: relative;
  align-items: center;
  width: 100%;
}
.el-menu-item span {
  white-space: normal;
  word-break: break-all;
  line-height: 20px;
  flex: 1;
}
</style>
